﻿<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<!--[if lt IE 9]>
<script type="text/javascript" src="lib/html5.js"></script>
<script type="text/javascript" src="lib/respond.min.js"></script>
<script type="text/javascript" src="lib/PIE_IE678.js"></script>
<![endif]-->
<link href="css/H-ui.min.css" rel="stylesheet" type="text/css" />
<link href="css/H-ui.admin.css" rel="stylesheet" type="text/css" />
<link href="css/style.css" rel="stylesheet" type="text/css" />
<link href="lib/Hui-iconfont/1.0.7/iconfont.css" rel="stylesheet" type="text/css" />
<!--[if IE 6]>
<script type="text/javascript" src="lib/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
<title>区域列表</title>
</head>
<body>
<div class="pd-20">
	<form action="" method="post" class="form form-horizontal" id="form1">
		
		<div class="row cl">
	
			<div class="formControls col-12" id="content_sp">
			</div>
		</div>

		<div class="row cl pr-20" style="position:fixed; bottom:10px; width: 200px; right: 10px; text-align: right; z-index:1000; ">
			<button type="button" class="btn btn-primary radius" id="area-save"><i class="Hui-iconfont">&#xe632;</i> 保存</button>
		</div>
	</form>
</div>

<script id="test" type="text/html">
<% for (x in list) { %>
	<dl class="permission-list">
		<dt>
			<label>
				<input type="checkbox" value="<%=list[x].aid%>" name="province_id" id="user-Character-0">
				<%=list[x].aname%>
			</label>
		</dt>

		<dd>
			<dl class="cl permission-list2">
				<dd style="margin-left: 0px;">
				<%for (j in list[x].child){%>
					<label class="" style="display: inline-block;">
						<input type="checkbox" value="<%=list[x].child[j].aid%>" name="city_id" id="user-Character-0-1-0">
						
						<span class="s-pointer" title="<%=list[x].child[j].aname%>"><%=list[x].child[j].aname%></span>
					</label>
				<%}%>
				</dd>
			</dl>
		</dd>

	</dl>
<%}%>
</script>	
<script type="text/javascript" src="lib/jquery/1.9.1/jquery.min.js"></script> 

<script type="text/javascript" src="lib/Validform/5.3.2/Validform.min.js"></script>
<script type="text/javascript" src="lib/layer/2.1/layer.js"></script>
<script type="text/javascript" src="js/H-ui.js"></script> 
<script type="text/javascript" src="js/H-ui.admin.js"></script>
<script type="text/javascript" src="js/s.js"></script> 
<script type="text/javascript" src="js/template-native.js"></script> 
<script>
function removeIframe(){
	var index = parent.layer.getFrameIndex(window.name);
    parent.layer.close(index);
}
$(function(){
	
var ss='abcd';


	var editid=getUrlParam('editid');//编辑权限id

	$("#form1").attr("action", API_TRANSTMPDETAIL); 






	// 罗列权限列表
	$.getJSON(API_AREA,function(data){
		var data={'list':data.datas};
		var html=template('test',data);
		document.getElementById('content_sp').innerHTML=html;
		// 全选按钮
		$(".permission-list dt input:checkbox").click(function(){
			$(this).closest("dl").find("dd input:checkbox").prop("checked",$(this).prop("checked"));
		});
	})

	$(document).on('click','button#area-save',function(){
		var provinceids="";
		var cityids="";
		var names="";
		$("input[name='province_id']:checked").each(function(e){
			provinceids=provinceids+$(this).val()+",";
			names=names+$(this).next("span").text()+",";
		})
		$("input[name='city_id']:checked").each(function(e){
			cityids=cityids+$(this).val()+",";
			names=names+$(this).next("span").text()+",";
		})
		console.log(names);
		removeIframe();
	})   

	


	// Validformsubmit("#form1");


});
</script>
</body>
</html>